require 'rubygems'
require 'ruby-debug'

raise "bad args -- want glob, sess. ex: #{__FILE__} 8c74eda886455b74e528a8bcc4fa052d *.log [short]" unless ARGV.length > 1
session = ARGV[2]

a = /^(Processing[^\n]* at ([^\)]*)[^\n]*\n  Session ID: #{session}.*?\})\n........+\n\n\n/m
a =  /((#{session}.*?\n\n\n))/m unless ARGV[2] == 'short' # todo -- needs some love! might not order right, still. oh well


settings = []
filenames = Dir.glob(ARGV[1])
raise 'no files fond' + ARGV[1] unless filenames.length > 0
for filename in filenames do
 all = File.read(filename);
 print "read #{filename}--scanning\n"
 all.scan(a) do |setting| # could do--replace default named ones with their line number :)
    settings << [setting[1], setting[0]]
 end
 print "done with file\n"
end 

for date, setting in settings.sort
 print setting, "\n\n"
end
